package com.wet.wired.jrc.frame.capture;

import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

public class ScreenGrabber {

	private Robot robot;
	private Rectangle screenRectangle;

	public ScreenGrabber() throws AWTException {
		initialize();
	}

	private void initialize() throws AWTException {
		robot = new Robot();
		screenRectangle = new Rectangle(Toolkit.getDefaultToolkit()
				.getScreenSize());

	}

	public Dimension getFrameSize() {
		return screenRectangle.getSize();
	}

	public void grabFrame() {
		BufferedImage grab = robot.createScreenCapture(screenRectangle);
		int[] rawData = new int[screenRectangle.width * screenRectangle.height];
		grab.getRGB(0, 0, screenRectangle.width, screenRectangle.height,
				rawData, 0, screenRectangle.width);

	}

}